New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Esc handling #220
Esc handling #220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, I like the Config::setActionKey()
cleanup.
@@ -344,7 +344,7 @@ void Config::setActionKey(ControlAction actionId, size_t index, InputKeyId key) | |||
return; | |||
} | |||
|
|||
// remove double key assignments | |||
// remove existing key assignments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be merged with the previous commit.
@@ -344,6 +344,9 @@ void Config::setActionKey(ControlAction actionId, size_t index, InputKeyId key) | |||
return; | |||
} | |||
|
|||
if (key == Keyboard::Key_Escape) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the space between "if" and "(".
Also, I'm not sure if it makes sense to special-case Escape in the Config class - we want to use Esc to clear key bindings, and that distinction should imo be higher up in the code.
Widget * widget = m_children.GetZoneWithID(BUTTON_MENUOPTIONS_CONTROLS_CUST_DEFAULT); | ||
|
||
if(widget == m_selected) { | ||
if(m_selected->GetZoneWithID(BUTTON_MENUOPTIONS_CONTROLS_CUST_DEFAULT)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your new code will match any widgets containing the "Default" button. Not sure if these can ever be "selected" though but it would be safer to just check the id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is true though "Default" is not used by any other widgets than those 2 control configs.
I was thinking some more refactoring here would be good anyway as this part of MenuPage class contains lot of code which is used only by those 2 classes. And MenuPage is inherited by 13 classes. E.g. if we could move some controls related code to ControlOptionsPage? Any thoughts about that?
Doing cleanup before assingment makes post cleanup redundant.
And only if menustate is not set
merged |
ESC binding is disabled and instead it is used for current key cleanup. Fixes https://bugs.arx-libertatis.org/arx/issues/408